#ifndef _OI_PLSCANNERCORE_REFERENCEDLG_HPP_
#define _OI_PLSCANNERCORE_REFERENCEDLG_HPP_

#include "Ctrl/OiDialog.hpp"

namespace Oi
{
    namespace PLScannerCore
    {
        class OI_PLSCANNER_CORE_API ReferenceItem : public QGraphicsObject
        {
            Q_OBJECT

        public:
            ReferenceItem(ProfileView *view, QGraphicsItem *parent = nullptr);

        public:
            QRectF boundingRect() const;

        public:
            void loadRef();

            void saveRef();


        public:
            void mousePressEvent(QGraphicsSceneMouseEvent *event);

            void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);

        private:
            OI_DISABLE_COPY(ReferenceItem);
            OI_DECLARE_IMPL(ReferenceItem);
        };

        class OI_PLSCANNER_CORE_API ReferenceDlg : public Ctrl::Dialog
        {
            Q_OBJECT
        public:
            ReferenceDlg(QWidget *parent = nullptr);
            ~ReferenceDlg();

        public slots:

            void onReady();

            void onSnap();

            void onCalib();

            void onAdd();

            void onDelete();

            void onClear();

            void onReferLineShow(bool);

        public:
            void addPoint(const QPointF& p);
            void setPoint(const QPointF& p);

            //void onEndModify();

            //void onRefHasChanged();

        private:
            OI_DISABLE_COPY(ReferenceDlg);
            OI_DECLARE_IMPL(ReferenceDlg);
        };

    }
}

#endif
